#include <stdio.h>
#include <math.h>

double funcos(double e, double x);

double main()
{
    double e, x;

    scanf("%lf %lf", &e, &x);
    printf("cos(%.2f) = %.6f\n", x, funcos(e, x));

    return 0;
}

double funcos(double e, double x)
{
    double molecule = 1;
    double denominator = 1;
    double sum = 1;
    double i = 0;
    double sign = -1;
    //sum start from item 2 (x**2/2!).
    while (molecule / denominator >= e)
    {
        molecule = molecule * x * x;
        denominator = denominator * (i + 1) * (i + 2);
        i += 2;
        sum += (molecule / denominator) * sign;
        sign = -sign;
    }
    return sum;
}